package com.hongxun.design.mytools;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;

/**
 * Created by zerdoor_pc on 2016/3/1.
 */
public class IntentToActivity {

    public static void intent(Activity start, Class<? extends Activity> end, Bundle bundle) {
        Intent i = new Intent(start, end);
        i.putExtras(bundle);
        start.startActivity(i);
    }

    public static void intentFlag(Activity start, Class<? extends Activity> end, Bundle bundle) {
        Intent i = new Intent(start, end);
        i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        i.putExtras(bundle);
        start.startActivity(i);
    }
    public static void intentActivityForResult(Activity start, Class<? extends Activity> end, Bundle bundle,int CODE) {
        Intent i = new Intent(start, end);
        i.putExtras(bundle);
        start.startActivityForResult(i, CODE);
    }

    public static void intent(Activity start, Class<? extends Activity> end) {
        Intent i = new Intent(start, end);
        start.startActivity(i);
    }

    public static void intentFinish(Activity start, Class<? extends Activity> end) {
        Intent i = new Intent(start, end);
        start.startActivity(i);
        start.finish();
    }

    public static void intent(Activity start, Class<? extends Activity> end,int flags) {
        Intent i = new Intent(start, end);
        i.setFlags(flags);
        start.startActivity(i);
    }
}
